home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TeX 1995 July
/
TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO
/
macros
/
latex209
/
contrib
/
multido
/
md-make.tex
(
.txt
)
< prev
next >
Wrap
LaTeX Document
|
1993-01-11
|
2KB
|
62 lines
%% md-make.tex 1992 tvz@Princeton.EDU
%% Run Plain TeX or LaTeX on this file to create a macro file multido.tex
%% from multido.doc, stripped of comments.
%% This is basically a take-off from F. Mittelbach's docstrip.tex
%% This macros can be used for stripping comments from any TeX file.
%% Just change these two lines:
\def\outfile{multido.tex}
\def\infile{multido.doc}
\catcode`\@=11
\expandafter\ifx\csname @latexerr\endcsname\relax\else\let\end\@@end\fi
\newread\@infile
\newwrite\@outfile
\def\typeout{\immediate\write16}
\typeout{}
\typeout{Preparing to make stripped macro file \outfile.}
\immediate\openin1=\outfile\relax
\ifeof1\else
\typeout{%
File `\outfile' exists and will be overwritten if in current directory!!!}
\def\check@@OK#1#2\@nil{\ifx#1y\else\expandafter\end\fi}
\typeout{Make `\outfile'? (y=yes, n=no)}
\read16 to\OK
\expandafter\check@@OK\OK\@nil
\newif\ifflag
{\catcode`\%=12\gdef\%{%}}
\edef\@@percent{\%\%}
\def\process@line{\expandafter\process@@line\inline\relax\relax\@nil}
\def\process@@line#1#2#3\@nil{%
\def\temp{#1}%
\ifx\temp\%
\def\temp{#1#2}%
\ifx\temp\@@percent\owrite\inline\fi
\else
\owrite\inline
\fi}
\def\owrite#1{\immediate\write\@outfile{#1}}
\def\mo#1{\catcode`#1=12\relax}
\def\sanitize{\mo\ \mo\\\mo\$\mo\&\mo\#\mo\^\mo\_\mo\%\mo\~\mo\}\mo\{}
\def\stripfile{%
\begingroup
\sanitize
\endlinechar-1
\flagtrue
\loop
\read\@infile to\inline
\ifeof\@infile\flagfalse\fi
\ifflag
\process@line
\repeat
\endgroup}
\immediate\openout\@outfile\outfile\relax
\owrite{\%\% This is file `\outfile' generated on
<\the\year/\the\month/\the\day>.}
\owrite{\%\% The original source file was `\infile'.}
\owrite{\%\%}
\immediate\openin\@infile\infile\relax
\stripfile
\immediate\closein\@infile
\owrite{\%\%}%
\owrite{\%\% End of file `\outfile'.}%
\immediate\closeout\@outfile